<?php
/**
 * FLARE Lang class
 * extended to allow us to return whole array of langs for access within smarty
 *
 */
class FLARE_Lang extends CI_Lang
{
	/**
	 * load all language files
	 *
	 * @param	string	language to load
	 */
	public function load_lang($lang)
	{
		$scandir = scandir(FCPATH.APPPATH.'language/'.$lang.'/');
		$ignore = array('.', '..', '.svn', 'index.html');		
		foreach($scandir as $k => $file)
		{
			if(in_array($file, $ignore))
				continue;
				
			$file = str_replace('_lang.php', '', $file);
			$this->load($file, $lang);
		}	
	}

	/**
	 * translate a string - if not translation found return string
	 *
	 * @param	string	string to translate
	 */
	public function translate($string)
	{
		$translated = $this->line($string);
		if($translated !== FALSE)
		{
			$string = $translated;
		}
		return $string;
	}
}

/* End of file Lang.php */
/* Location: ./application/core/FLARE_Lang.php */